Image processing method and apparatus

ABSTRACT

In image processing adapted to a display apparatus using a plurality of line buffers for storing data regarding dots aligned on scanning lines on the screen, when a line having a prescribed width and a prescribed length is drawn on the screen, a line drawing range is calculated with reference to start-point coordinates and end-point coordinates as well as the width of line, thus selecting dots on the screen with reference to coordinates of intersections between the scanning lines and the boundaries of the line drawing range, wherein data regarding the selected dots are written into at least one of the line buffers. In line terminating processing, a virtual circle whose diameter matches the width of the line is imaginarily drawn at one end of the line, so that data regarding dots belonging to the virtual circle are written into at least one of the line buffers.

RELATED APPLICATIONS

This application is a divisional of U.S. patent application Ser. No.11/070,941, filed Mar. 3, 2005, now U.S. Pat. No. ______, which in turnclaims priority from Japanese Patent Application No. 2004-063889, filedMar. 8, 2004, and Japanese Patent Application No. 2004-067348, filedMar. 10, 2004, the contents of which are incorporated herein byreference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to image processing methods and apparatuses thatprocess image data representing lines having prescribed lengths andwidths displayed on monitor screens.

2. Description of the Related Art

Conventionally, various kinds of software programs have been developedto display a plurality of lines (or line segments) having prescribedlengths and widths on screens of monitors (or displays), whereinstart-point coordinates and end-point coordinates of lines as well aswidths of lines are designated by central processing devices (CPUs) toproduce three data therefor, which are converted into dot data and arethen written into frame buffers having storage capacities, whichcorrespond to numbers of dots displayed on two-dimensional flat screensof monitors. Then, dot data stored in frame buffers are supplied tomonitors (such as liquid crystal displays) so as to display lines onscreens, wherein double-buffer configurations are arranged to realizeread/write operations regarding dot data. This technology is disclosedin Japanese Patent Application Publication No. H04-175887, for example.

Normally, image processing apparatuses are each constituted by LSIdevices, wherein frame buffers are incorporated into chips of LSIdevices. However, fame buffers have relatively large storage capacities,which require relatively large chip areas. For this reason, it ispreferable for image processing apparatuses not to incorporate framebuffers but to incorporate line buffers, each having a relatively smallstorage capacity corresponding to a limited number of dots on a single(horizontal) scanning line, in consideration of manufacturing costs andsizes, which should be reduced.

However, it takes a relatively long time to convert three pieces ofdata, representing start-point coordinates and end-point coordinates oflines as well as widths of lines, into dot data. Such processingexecuted by conventional line buffers having limited capacities may failto precisely display lines having prescribed lengths and widths onmonitor screens.

For example, a conventionally known image processing apparatus displaysa line having a prescribed width, wherein a start-point terminal and anend-point terminal lie in parallel with or lie perpendicular tohorizontal scanning lines on the monitor screen as shown in FIG. 19.This makes it very difficult to display a line having a prescribed widthwhose start-point terminal and end-point terminal lie perpendicular tothe length direction as shown in FIG. 20.

When lines having prescribed widths are drawn without performingcircular terminating processes on end portions thereof, end portions oflines should be deteriorated in appearances on monitor screens. Inparticular, when two lines are drawn to connect together on the monitorscreen, they cannot be connected smoothly at the connecting areatherebetween. Japanese Patent Application Publication No. S62-285188teaches a solution to this problem, in which as shown in FIG. 21A, inwhich a circle is drawn at the connecting area between two lines, thusrealizing smooth connection therebetween.

The aforementioned process is performed in such a way that a circlewhose diameter matches the horizontal width of a line, which lies inparallel with horizontal scanning lines on the monitor screen, or thevertical width of a line, which lies perpendicular to horizontalscanning lines on the monitor screen, is drawn in the connecting area atwhich two lines are connected together. This causes a problem in thatthe diameter of the circle becomes greater than the horizontal width ofthe line or the vertical width of the line, whereby two lines cannot beconnected smoothly on the monitor screen. In addition, theaforementioned circular terminating process is performed with respect tothe connecting area, which is detected between two lines and in which acircle is drawn. That is, other ends of lines cannot be made smooth inappearance on the monitor screen. In addition, the circular terminatingprocess requires a relatively great burden of load in the circuitry forautomatically discriminating the connecting area between two lines.

SUMMARY OF THE INVENTION

It is an object of the invention to provide an image processing methodand an image processing apparatus, which allow lines having prescribedwidths to be displayed on the monitor screen by use of line buffers insuch a way that start-point terminals and end-point terminals of linesare drawn perpendicular to length directions of lines.

It is another object of the invention to provide an image processingmethod and an image processing apparatus, which produce smoothconnecting areas drawn between lines and which make other ends of linessmooth in appearance on the monitor screen.

In a first aspect of the invention, an image processing method adaptedto a display apparatus using a plurality of line buffers for storingdata regarding dots aligned on scanning lines displayed on the screen isrealized by a first step for calculating a line drawing range of a linethat is displayed on the screen, which lies in a vertical direction ofthe screen, wherein the line has a prescribed width and a prescribedlength defined between start-point coordinates and end-point coordinateswithin the line drawing range, so that dots not belonging to the linedrawing range are not displayed on the screen; a second step forselecting dots on scanning lines to be displayed on the screen withreference to coordinates of intersections between the scanning lines andboundaries of the line drawing range; and a third step for writing dataregarding the selected dots on the scanning lines into at least one ofthe line buffers.

In a second aspect of the invention, an image processing method adaptedto a display apparatus using a plurality of line buffers for storingdata regarding dots aligned on scanning lines displayed on the screen isrealized by a first step for calculating a line drawing range of a linethat is displayed on the screen, which lies in a vertical direction ofthe screen, wherein the line has a prescribed width and a prescribedlength defined between start-point coordinates and end-point coordinateswithin the line drawing range, so that dots not belonging to the linedrawing range are not displayed on the screen; a second step forcalculating the inclination of the line based on the start-pointcoordinates and end-point coordinates; a third step for when theinclination of the line ranges from 45° to 135° against each of thescanning lines, calculating center coordinates at which a scanning lineintersects with the center of the line so as to produce ascanning-direction length of the line based on the start-pointcoordinates and end-point coordinates as well as the width of the linewithin the line drawing range, thus calculating coordinates ofintersections between the scanning lines and the boundaries of the linedrawing range on the basis of the center coordinates andscanning-direction length of the line; a fourth step for when theinclination of the line ranges from 0° to 45° or ranges from 135° to180°, calculating a scanning-direction length of the line based on thestart-point coordinates and end-point coordinates as well as the widthof the line within the line drawing range, thus calculating coordinatesof intersections between the line and the boundaries of the line drawingrange on the basis of the start-point coordinates and end-pointcoordinates as well as the width of the line; a fifth step for selectingdots to be displayed on the screen with reference to the coordinates ofintersections; and a sixth step for writing data regarding the selecteddots on the scanning lines into at least one of the line buffers.

In the above, the image processing method further includes a seventhstep for making a decision as to whether or not line terminatingprocessing is performed on at least one end of the line displayed on thescreen; and an eighth step for in the line terminating processing,calculating limit values for dots displayed on the screen on the basisof at least one of the start-point coordinates and the end-pointcoordinates of the line, whereby prescribed dots ranging between thelimit values are written into at least one of the line buffers so as toprevent other dots not ranging between the limit values from beingwritten into at least one of the line buffers.

In a third aspect of the invention, an image processing method adaptedto a display apparatus using a plurality of line buffers for storingdata regarding dots aligned on scanning lines displayed on the screen isrealized by a first step for when a line having a predetermined widthand a predetermined length is drawn on the screen, detecting dotsbelonging to a virtual circle, which is drawn at one end of the line andwhose diameter matches the width of the line; and a second step forwriting data regarding the detected dots into at least one of the linebuffers.

In a fourth aspect of the invention, an image processing method adaptedto a display apparatus using a plurality of line buffers for storingdata regarding dots aligned on scanning lines displayed on the screen isrealized by a first step for reading line attribute data representingattributes of a line, having a prescribed width and a prescribed length,to be drawn on the screen from a storage device; a second step formaking a decision as to whether or not the line attribute data designateline terminating processing to be performed on at least one end of theline; in a third step for in the line terminating processing, detectingdots belonging to a virtual circle, which is drawn at one end of theline and whose diameter matches the width of the line; and a fourth stepfor writing data regarding the detected dots into at least one of theline buffers.

In the above, dots are detected based on the line attribute datadesignating the line terminating processing with reference tostart-point coordinates or end-point coordinates of the line. Inaddition, dots are detected based on area ratios, each of which iscalculated with reference to a boundary of the virtual circle drawn atone end of the line.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other objects, aspects, and embodiments of the presentinvention will be described in more detail with reference to thefollowing drawings, in which:

FIG. 1 is a block diagram showing essential parts of an image processingdevice using line buffers in accordance with a preferred embodiment ofthe invention;

FIG. 2 is a block diagram showing the constitution of a displayapparatus incorporating the image processing device shown in FIG. 1;

FIG. 3 shows the stored contents of a general table incorporated in theimage processing device shown in FIG. 2;

FIG. 4 shows the overall layout for layers whose contents are writtenover each other;

FIG. 5 shows relationships between lines displayed on a monitor screenand contents of line buffers having write/display functions shown inFIG. 1;

FIG. 6 diagrammatically shows a line having a prescribed width and aprescribed length, which is to be displayed on the monitor screen;

FIG. 7 is a flowchart showing line drawing processing;

FIG. 8 is a flowchart showing details of a line drawing step shown inFIG. 7;

FIG. 9A shows a method how to determine a draw reference point withrespect to an even-numbered width of a line drawn on the monitor screen;

FIG. 9B shows a method how to determine a draw reference point withrespect to an odd-numbered width of a line drawn on the monitor screen;

FIG. 10 shows an inclined line used for calculations regardinginclination and direction;

FIG. 11 shows a rectangular coordinates system for discriminating typesof lines, which are started from the origin and are drawn in differentdirections;

FIG. 12 shows a vertically directed line having a line drawing widthdisplayed in relation to scanning lines;

FIG. 13 shows a line drawing range with regard to a vertically directedline;

FIG. 14 shows a vertically directed line subjected to line terminatingprocessing with regard to start-point coordinates;

FIG. 15 shows a vertically directed line subjected to line terminatingprocessing with regard to end-point coordinates;

FIG. 16 shows a horizontally directed line subjected to line drawingprocessing;

FIG. 17A shows a circle drawn at a start-point terminal or an end-pointterminal of a line having an even-numbered width;

FIG. 17B shows a circle drawn at a start-point terminal or an end-pointterminal of a line having an odd-numbered width;

FIG. 18A shows stored data regarding a circle, which is drawn at astart-point terminal or an end-point terminal of a line having aneven-numbered width;

FIG. 18B shows stored data regarding a circle, which is drawn at astart-point terminal or an end-point terminal of a line having anodd-numbered width;

FIG. 19 show lines whose widths lie in parallel with or perpendicular tohorizontal scanning lines displayed on a monitor screen;

FIG. 20 shows a line whose start-point terminal and end-point terminallie in a length direction thereof; and

FIG. 21A shows two lines that are connected together at a connectingarea therebetween by drawing a circle whose diameter matches thehorizontal width of a line or the vertical width of a line on a monitorscreen; and

FIG. 21B shows two lines that are connected together smoothly at aconnecting area therebetween by drawing a circle whose width matches thewidth of a line.

DESCRIPTION OF THE PREFERRED EMBODIMENT

This invention will be described in further detail by way of exampleswith reference to the accompanying drawings.

FIG. 2 is a block diagram showing the constitution of a displayapparatus incorporating an image processing device 1 using line buffersin accordance with a preferred embodiment of the invention, whereinreference numeral 2 designates a pattern memory for storing spritepatterns; reference numeral 3 designates a central processing unit(i.e., a CPU) for controlling image display processes; and referencenumeral 4 designates a monitor using a cathode-ray tube (i.e., a CRT).

In the image processing device 1, reference numeral 11 designates apattern memory interface; reference numeral 12 designates a CPUinterface; reference symbol B designates a bus line; and referencenumeral 14 designates a color palette for converting color codes intoRGB color data (where R, G, and B designate red, green, and blue). Thepattern memory 2 stores image data representing sprite patterns in theform of color codes, which are converted into RGB color data by thecolor palette 14. In addition, reference numeral 15 designates a generaltable; and reference numeral 16 designates a register (or registers) fortemporarily storing data. The CPU 3 writes data into the general table15, which has a layer setup table 15 a and a line attribute table 15 bas shown in FIG. 3.

The layer setup table 15 a is constituted by a plurality of layers. FIG.4 shows the overall layout for layers #0 to #5, wherein the layer #0 iswritten first, then, other layers #1, #2, . . . are sequentially writtenover. Each of the layers corresponds to a sprite display layer or a linedisplay layer. The sprite display layer describes sprite attribute data.The line display layer describes a start-point address and an end-pointaddress with respect to each of lines #0, #1, . . . listed in the lineattribute table 15 b. As sprite attribute data, it is possible to listidentification numbers of sprites, display position data for designatingdisplay positions, and rendering data for designating magnification andreduction of images on the monitor screen. The line attribute table 15 bdescribes various attributes of lines, i.e., start-point coordinates andend-point coordinates of lines, widths of lines, and colors of lines aswell as start-point circle drawing data for designating circles whosediameters match widths of lines to be drawn at start-points of lines,and end-point circle drawing data for designating circles whosediameters match widths of lines to be drawn at end-points of lines.

In FIG. 3, the layer setup table 15 a describes seven layers #0 to #6,wherein the layer #2 corresponds to a line display layer, and otherlayers #0, #1, and #3 to #6 correspond to sprite display layers, each ofwhich stores attributes regarding a single sprite. The layer #2describes a start-point address “200h” and an end-point address “238h”.In addition, the line attribute table 15 b describes attributesregarding eight lines #0 to #7 each designating a start-point addressand an end-point address.

In FIG. 2, a sprite plane generator 18 sequentially reads spriteattribute data from the prescribed layers of the layer setup table 15 a,wherein it extracts identification numbers of sprites from the readsprite attribute data so as to supply them to the pattern memoryinterface 11. The pattern memory interface 11 reads image datarepresenting sprite patterns designated by identification numbers fromthe pattern memory 2, thus supplying them to the sprite plane generator18. Image data are transferred from the sprite plane generator 18 to thecolor palette 14, in which they are converted into RGB color data, whichare then supplied to a sprite rendering processor 19 together withsprite attribute data.

The sprite rendering processor 19 performs rendering processes (such asmagnification, reduction, and rotation based on rendering data) on RGBcolor data output from the sprite plane generator 18, so thatrendering-completed color data are written into line buffers 20. A lineplane generator 22 reads the start-point address and end-point addressfrom the line display layer in the layer setup table 15 a, whereby itreads line attribute data from the line attribute table 15 b based onthe read addresses. The read line attribute data are supplied to a linerendering processor 23, wherein color codes for designating colors oflines are converted into RGB color code with reference to the colorpalette 14.

Based on start-point coordinates and end-point coordinates of lines,widths of lines, start-point circle drawing data, and end-point circledrawing data, all of which are included in line attribute data, the linerendering processor 23 calculates dots incorporated in lines to bedisplayed on the monitor screen, whereby RGB color data, which areproduced by converting color codes included in line attribute data withreference to the color palette 14, are written into the line buffers 20at prescribed storage positions corresponding to the calculated dots.

There are provided two line buffers 20 each having a plurality of memoryslots corresponding to dots on a single horizontal scanning line. Thetwo line buffers 20 alternately serve as a read buffer and a writebuffer. A CRT controller (CRTC) 26 generates various pulse signals suchas horizontal scanning pulses and vertical scanning pulses for drivingthe monitor 4 based on clock pulses generated by a clock generationcircuit 25, wherein pulse signals are supplied to the monitor 4 and aframe data controller 27. The frame data controller 27 reads color datafrom the line buffers 20 so as to supply them to digital-to-analogconverters (DACs) 28 a, 28 b, and 28 c in synchronization withhorizontal scanning pulses. The DACs 28 a to 28 c convert color datainto analog color signals, which are then supplied to the monitor 4.

Next, the outline of line drawing processing using line buffers will bedescribed with reference to FIGS. 1, 5, and 6.

FIG. 1 is a block diagram showing essential parts of the imageprocessing device, which are extracted from the constitution shown inFIG. 2 in terms of line drawing processing. In order to draw a line onthe monitor screen, the CPU 3 sets line attribute data (such asstart-point coordinates and end-point coordinates of lines, widths oflines, colors of lines, start-point circle drawing data, and end-pointcircle drawing data) to the line attribute table 15 b. A line drawingblock RB, which corresponds to the line plane generator 22 and the lienrendering processor 23 shown in FIG. 2, reads line attribute data, whichare set to the line attribute table 15 b with respect to linesrespectively, wherein it performs calculations regarding displaypositions by use of attributes of lines, so that color data representingcolors of lines, which are designated by line attribute data, arewritten into line buffers 20 a and 20 b at prescribed display positions.

A display interface block D1, which corresponds to the frame datacontroller 27 and the DACs 28 a to 28 c, reads color data from the linebuffers 20 a and 20 b in synchronization with scan timings that aregenerated by the CRT controller 26 with respect to the monitor 4, sothat the read color data are supplied to the monitor 4 as head data.

The line buffers 20 a and 20 b construct a double-buffer configurationfor realizing writing and displaying functions thereby, wherein they areadequately changed over in writing and displaying functions with respectto each of lines displayed on the monitor screen. As shown in FIG. 5,the line buffers 20 a and 20 b alternately performs write/displayoperations with respect to each of lines displayed on the monitorscreen. For example, when the line buffer 20 a proceeds to displayingline 0, data regarding line 1 are written into the line buffer 20 b. Atthe completion of displaying line 0 on the monitor screen, the linebuffers 20 a and 20 b are changed over in functions thereof, so thatdata regarding line 1 written into the line buffer 20 b is subjected todisplay. When line 1 is displayed on the monitor screen, data regardingline 2 are written into the line buffer 20 a. As described above, theline-buffer display system is advantageous in that it can reduce thetotal amount of memory capacity compared with the frame-buffer displaysystem, whereas it has a drawback in that parameters regarding previouslines written into line buffers cannot be maintained.

Suppose that as shown in FIG. 6, a line having a width LW is drawn fromstart-point coordinates (LSX,LSY) to end-point coordinates (LEX,LEY). Inthe line-buffer display system, it is necessary to calculate coordinatesregarding a start-point dot DRS and an end-point dot DRE with respect toeach of horizontal lines being drawn on the monitor screen, whereincolor data regarding the designated color of a line are written intoline buffers at addresses ranging from DRS to DRE. When both thestart-point circle drawing data and end-point circle drawing data areset to ‘1’, circles both having the same diameter corresponding to thewidth LW are supposed to be drawn at the start-point terminal andend-point terminal of the line, wherein color data are written withrespect to internal areas of semicircular areas encompassed by dottedcurves in FIG. 6.

Next, details of the line drawing processing will be described withreference to FIGS. 7, 8, 9A, 9B, 10, 11, 12, 13, 14, 15, 16, 17A, 17B,18A, and 18B.

FIG. 7 is a flowchart showing steps for the line drawing processingdescribed above. In step Sa1, the line drawing block RB (see FIG. 1)loads line attribute data from the line attribute table 15 b. In stepSa2, the CPU 3 performs line drawing operations based on line attributedata except for a start-point circle and an end-point circuitrespectively drawn at terminals of a line. In step Sa3, a decision ismade as to whether or not line attribute data regarding start-pointcircle drawing is turned ON (or set to ‘1’). When a start-point circleis ON, the flow proceeds to step Sa4 so as to proceed to processing fordrawing a start-point circle with respect to the line. If it is not ON,the flow proceeds to step Sa5, in which a decision is made as to whetheror not line attribute data regarding end-point circle drawing is turnedON (or set to ‘1’). When an end-point circuit is ON, the flow proceedsto step Sa6 so as to proceed to processing for drawing an end-pointcircle with respect to the line. If it is not ON, the flow proceeds tostep Sa7, in which a decision is made as to whether or not the linepresently subjected to line drawing processing designates the last linebelonging to the presently processed layer. If so, the CPU 3 ends theline drawing processing shown in FIG. 7. If not, the flow returns tostep Sa1 so as to proceed to line drawing processing with respect to thenext line.

Next, details of the step Sa2 regarding line drawing operations will bedescribed with reference to FIG. 8 etc. FIGS. 9A and 9B show methods howto determine draw reference points. As shown in FIG. 9A, when the widthLW of the line is referred to as an even-numbered width (realized by aneven number of dots displayed on the monitor screen), start-pointcoordinates and end-point coordinates on the grid directly show a drawreference point. As shown in FIG. 9B, when the width LW of the line isreferred to as an odd-numbered width (realized by an odd number of dotsdisplayed on the monitor screen), start-point coordinates and end-pointcoordinates on the grid are each added with a value 0.5 in terms ofX-axis and Y-axis coordinates so as to produce a draw reference point.The reason why the draw reference point is shifted with respect to theline having the odd-numbered width is to realize smooth drawing of theline to be displayed on the monitor screen. In the followingdescription, start-point coordinates and end-point coordinates areexpressed as follows:

Start point (LSX,LSY)

End point (LEX,LEY)

where the origin of the coordinates system matches the upper-left cornerof the monitor screen.

Next, detailed descriptions will be given with respect to steps S1 toS12 in the flowchart shown in FIG. 8.

(S1) Load Line Attribute Data

The line drawing block RB (see FIG. 1) sequentially reads line attributedata from the line attribute table 15 b before the monitor 4 startsshowing scanning lines on the screen. Herein, the line attribute datainclude start-point coordinates and end-point coordinates of lines,widths of lines, and colors of lines, for example.

(S2) Calculate Drawing Area in Y-Axis Direction

In order to determine whether or not scanning lines (where Y=YN) belongto the internal area of a line to be drawn (i.e., a line drawing range),or whether or not they cross the line to be drawn, a minimal value Yminand a maximal value Ymax are calculated with respect to the line interms of the Y-axis direction, wherein they are expressed by differentequations in response to the odd-numbered width of the line and theeven-numbered width of the line respectively.

Odd-numbered width

Ymin=min(LSY,LEY)+0.5−LW/2

Ymax=max(LSY,LEY)+0.5+LW/2

Even-numbered width

Ymin=min(LSY,LEY)−LW/2

Ymax=max(LSY,LEY)+LW/2

In the above, the function “min(A,B)” indicates smaller one selectedbetween A and B; and the function “max(A,B)” indicates larger oneselected between A and B. In addition, the value “0.5” is used to shiftstart-point coordinates and end-point coordinates as well as the drawreference point in the case of the odd-numbered width of the line shownin FIG. 9B. By shifting them by 0.5, it is possible to reduce theunnatural appearance of the line drawn on the monitor screen.

When scanning lines each belong to the range defined between Ymin andYmax and also belong to the prescribed line terminal processing range, adecision is made as to whether or not they belong to the line drawingrange after executing line terminal processing, as follows:

Odd-numbered width

LSY+0.5−LW/2≦YN<LSY+0.5+LW/2

LEY+0.5−LW/2≦YN<LEY+0.5+LW/2

Even-numbered width

LSY−LW/2≦YN<LSY+LW/2

LEY−LW/2≦YN<LSY+LW/2

Incidentally, details of the line terminating processing will bedescribed later.

(S3) Decision as to Line Drawing Range

When scanning lines are each smaller than Ymin with respect to the linedrawn on the monitor screen, or when they are each greater than Ymax,they should be out of the line drawing range, so that they are notsubjected to draw processing. This is indicated by “NO” in step S3, sothat the flow proceeds to processing of the next line. In the case ofthe line terminating processing range, the line terminating processingis performed; then, a decision is made as to whether or not scanninglines belong to the line drawing range. When it is determined thatscanning lines belong to the line drawing range after the execution ofthe line terminating processing, in other words, when they range betweenYmin and Ymax and belong to the inside of the line terminatingprocessing range, in short, when the decision result of step S3 turns to“YES”, the flow proceeds to the following steps (starting from step S4).

(S4) Calculation of Inclination, and Determination of Direction

A line is drawn in a direction from its start-point to its end-point onthe monitor screen. Therefore, the line drawing method depends on thestart-point and end-point of the line, and it also depends on theinclination of the line (represented by a value of |LEX−SLX|/|LEY−LSY|).For this reason, it is necessary to calculate the inclination of theline and to determine the direction of the line before the line isactually drawn on the monitor screen.

(a) Calculations of Inclinations

Suppose that as shown in FIG. 10, a line L is drawn from start-pointcoordinates (LSX,LSY) to end-point coordinates (LEX,LEY) with an X-axisinclination DX and a Y-axis inclination DY, which are calculated asfollows:

DX=Lx/Ly=(LEX−LSX)/(LEY−LSY)

DY=Ly/Lx=(LEY−LSY)/(LEX−LSX)

Actually, the inclinations DX and DY are produced by calculating ΔX andΔY as follows:

ΔX=1/(LEX−LSX)

ΔY=1/(LEY−LSY)

where a plurality of inverse values regarding ΔX and ΔY are stored in aROM in advance.

Using ΔX and ΔY, the following calculations are performed to produce DXand DY

DX=(LEX−LSX)×ΔY

DY=(LEY−LSY)×ΔX

(b) Determination of Directions

Suppose that as shown in FIG. 11, the origin of the rectangularcoordinates system is set as a start point of a line, which is drawn ina direction lying in any one of regions 0, 1, 2, and 3. In FIG. 11,slanted lines are drawn and inclined to the X-axis and Y-axis of therectangular coordinates system by 45°, thus defining hatching areas andnon-hatching areas. Herein, the line is referred to as a horizontallydirected line when the end point thereof lies in the non-hatching areas;it is referred to as a vertically directed line when the end pointthereof lies in the hatching areas; it is referred to as a horizontalline when the end point thereof lies on the X-axis; and it is referredto as a vertical line when the end point thereof lies on the Y-axis.Thus, different types of line drawing processing are performed withrespect to different types of lines described above. Specifically, typesof lines are discriminated by the following calculations.

|LEX−LSX|/|LEY−LSY|>1: horizontally directed line

|LEX−LSX|/|LEY−LSY|≦1: vertically directed line

LEX−LSX=0, LEY−LSY≠0: vertical line

LEX−LSX≠0, LEY−LSY=0: horizontal line

In the above, regions 0 to 3 are determined by the followinginequalities.

LEX−LSX≧0, LEY−LSY≧0: region 0

LEX−LSX<0, LEY−LSY≧0: region 1

LEX−LSX<0, LEY−LSY<0: region 2

LEX−LSX≧0, LEY−LEY<0: region 3

(S5 to S7) Discrimination of Types of Lines

In accordance with the aforementioned calculations, types of lines arediscriminated and are therefore subjected to the following stepsrespectively.

Vertically directed line→step S8

Horizontally directed line→step S9

Vertical line→step S10

Horizontal line→step S11

(S8) Drawing of Vertically Directed Line

Details of drawing of a vertically directed line will be described withreference to FIGS. 12 to 15.

(1) Calculation of Center Point XN of Line

Suppose that as shown in FIG. 12, a line L1 connecting between a startpoint and an end point is drawn to cross a scanning line H (whereY=YN+0.5) at a point whose X-coordinate XN is calculated by thefollowing equations, which differ from each other with respect to typesof widths, i.e., an odd-numbered width and an even-numbered width.

Odd-numbered width: XN=(LSX+0.5)+{(YN+0.5)−(LSY+0.5)}×DX

Even-numbered width: XN=LSX+{(YN+0.5)−LSY}×DX

(2) Calculation of Line Drawing Width Wdr

A line drawing width Wdr is calculated based on the width LW of theline, which is determined in advance (see FIG. 6). This calculation isrealized by reading appropriate values representing calculation results;which are stored in a ROM in advance.

Wdr=round(√(1+|DX| ²)×LW,0)

In the above, the function “round(A,0)” indicates rounding off to thenearest whole number.

(3) Calculations of Coordinates XLr, XRr

A left-side line L2 is drawn in the left side of the line L1 to crossthe scanning line H at an X-axis coordinate XLr, and a right-side lineL3 is drawn in the right side of the line L1 to cross the scanning lineH at an X-axis coordinate XRr, wherein these coordinates are calculatedas follows:

XLr=XN−Wdr/2

XRr=XN+Wdr/2

(4) Calculations of Limit Values XMAX, XMIN in X-Axis Line Drawing Range

When the Y-axis coordinate YN of the scanning line H belongs to theaforementioned line terminating processing range (see step S2 shown inFIG. 8), limit values XMAX and XMIN are calculated with reference to theX-axis line drawing range, within which dots used for drawing the lineare determined. This is called line terminating processing. As shown inFIG. 13, the X-axis line drawing range lies between lines M1 and M2,both of which are drawn perpendicular to the line L and which are drawnto pass the start point and end point of the line L respectively. Thelimit values XMAX and XMIN are produced by the following calculations.

First, as shown in FIG. 14, X-axis line drawing ranges XSlimit dependingon the start-point coordinates (LSX, LSY) are calculated with respect tothe odd-numbered width of line and the even-numbered width of linerespectively.

Odd-numbered width: XSlimit=(LSX+0.5)−{(YN+0.5)−(LSY+0.5)}×DY

Even-numbered width: XSlimit=LSX−{(YN+0.5)−LSY}×DY

Next, as shown in FIG. 15, X-axis line drawing ranges XElimit dependingon the end-point coordinates (LEX, LEY) are calculated with respect tothe odd-numbered width of line and the even-numbered width of linerespectively.

Odd-numbered width: XElimit=(LEX+0.5)−{(YN+0.5)−(LEY+0.5)}×DY

Even-numbered width: XElimit=LEX−{(YN+0.5)−LEY}×DY

Thus, the limit values XMIN and XMAX can be directly determined usingthe X-axis line drawing ranges XSlimit and XElimit with respect to theregions 0 to 3 shown in FIG. 11 as follows:

Region 0: XMIN=XSlimit, XMAX=XElimit

Region 1: XMIN=XElimit, XMAX=XSlimit

Region 2: XMIN=XElimit, XMAX=XSlimit

Region 3: XMIN=XSlimit, XMAX=XElimit

(5) Calculations of DRS and DRE

By use of the aforementioned values XLr, XRr, XMIN, and XMAX, a linedrawing start dot DRS and a line drawing end dot DRE are calculated asfollows:

DRS=round(max(XLr,XMIN),0)

DRE=round(min(XRr,XMAX),0)

(6) Writing of Data into Line Buffers

Designated line color data are written into line buffers at prescribedaddresses corresponding to dots ranging from DRS to DRE (see hatchingareas shown in FIGS. 14 and 15). Herein, writing is performedconsecutively until one dot prior to DRE, so that DRE is not included inline drawing.

(S9) Drawing of Horizontal Directed Line

Next, line drawing processing regarding horizontally directed lines willbe described with reference to FIG. 16.

(1) Calculation of Line Drawing Width Wdr

A line drawing width Wdr is calculated based on the width LW of theline, which is determined in advance. As to the horizontally directedline, the line drawing width Wdr lies perpendicular to the scanning lineas shown in FIG. 16. This calculation is realized by reading calculationresults, which are prepared in advance and are stored in a ROM.

Wdr=round(√(1+|DY| ²)×LW,0)

(2) Calculations of X-Axis Coordinates XLr and XRr at Left and RightEnds of Line

X-axis coordinates XLr defining left ends of lines are calculateddifferently with respect to the odd-numbered width and even-numberedwidth of lines and with respect to regions, as follows:

(a) Regions 0, 2

Odd-numbered width: XLr=(LSX+0.5)+{(YN+0.5)−(LSY+0.5)−Wdr/2}×DX

Even-numbered width: XLr=LSX+{(YN+0.5)−LSY−Wdr/2}×DX

(b) Regions 1, 3

Odd-numbered width: XLr=(LSX+0.5)+{(YN+0.5)−(LSY+0.5)+Wdr/2}×DX

Even-numbered width: XLr=LSX+{(YN+0.5)−LSY+Wdr/2}×DX

X-axis coordinates XRr defining right ends of lines are calculateddifferently with respect to the odd-numbered width and even-numberedwidth of lines and with respect to regions, as follows:

(a) Regions 0, 2

Odd-numbered width: XRr=(LSX+0.5)+{(YN+0.5)−(LSY+0.5)+Wdr/2}×DX

Even-numbered width: XRr=LSX+{(YN+0.5)−LSY+Wdr/2}×DX

(b) Regions 1, 3

Odd-numbered width: XRr=(LSX+0.5)+{(YN+0.5)−(LSY+0.5)−Wdr/2}×DX

Even-numbered width: XRr=LSX+{(YN+0.5)−LSY−Wdr/2}×DX

(3) Calculations of Limit Values XMAX, XMIN

The aforementioned calculations (described in item (4) regarding thedrawing of vertically directed lines in (S8)) can be adapted to producelimit values XMAX and XMIN in X-axis line drawing ranges with regard tothe drawing of horizontally directed lines.

(4) Calculations of DRS and DRE

The aforementioned calculations (described in item (5) regarding thedrawing of vertically directed lines in (S8)) can be adapted to producea line drawing start dot DRS and a line drawing end dot DRE with regardto the drawing of horizontally directed lines.

(5) Writing of Data into Line Buffers

Designated line color data are written into line buffers at prescribedaddresses corresponding to dots ranging from DRS to DRE, which is shownin the hatching area in FIG. 16. Herein, writing is performedconsecutively until one dot prior to DRE, so that DRE is not included inline drawing. When DRS≧DRE, no data is written into line buffers.

(S10) Drawing of Vertical Line

Next, line drawing processing regarding vertical lines (where LEX−LSX=0,LEY−LSY≠0) will be described below.

(1) Calculation of Y-Axis Line Drawing Range

As to the drawing of vertical lines, Y-axis line drawing ranges differfrom those adapted to the drawing of other types of lines, wherein limitvalues Ymin and Ymax are calculated only with respect to the prescribedcondition of Ymin≦YN<Ymax, and they are calculated differently withrespect to the odd-numbered width and even-numbered width of lines, asfollows:

Odd-numbered width: Ymin=min(LSY,LEY)+1

Ymax=max(LSY,LEY)+1

Even-numbered width: Ymin=min(LSY,LEY)

Ymax=max(LSY,LEY)

(2) Calculations of DRS and DRE

A line drawing start dot DRS and a line drawing end dot DRE arecalculated differently with respect to the odd-numbered width andeven-numbered width of lines, as follows:

Odd-numbered width: DRS=LSX+0.5−LW/2

DRE=LSX+0.5+LW/2

Even-numbered width: DRS=LSX−LW/2

DRE=LSX+LW/2

(3) Writing of Data into Line Buffers

Designated line color data are written into line buffers at addressescorresponding to dots ranging from DRS to DRE. Herein, writing isconsecutively performed until one dot prior to DRE, so that DRE is notincluded in line drawing.

(S11) Drawing of Horizontal Line

Next, line drawing processing regarding horizontal lines (whereLEX-LSX≠0, LEY−LSY=0) will be described below.

(1) Calculations of DRS and DRE

A line drawing start dot DRS and a line drawing end dot DRE arecalculated differently with respect to the odd-numbered width andeven-numbered width of lines, as follows:

Odd-numbered width: DRS=min(LSX,LEX)+1

DRE=max(LSX,LEX)+1

Even-numbered width: DRS=min(LSX,LEX)

DRE=max(LSX,LEX)

(2) Writing of Data into Line Buffers

Designated line color data are written into line buffers at addressescorresponding to dots ranging from DRS to DRE. Herein, writing isconsecutively performed until one dot prior to DRE, so that DRE is notincluded in the line drawing.

The aforementioned description is related to the line drawing processing(see step Sa2). Next, start-point circle drawing processing (see stepSa4) will be described with reference to FIGS. 17A and 17B; andend-point circle drawing processing (see step Sa6) will be describedwith reference to FIGS. 18A and 18B.

Each of the start-point circle drawing processing and end-point circledrawing processing is executed basically by three steps, namely, (E-1)decision as to whether or not scanning lines YN belong to circle drawingranges, (E-2) calculation of X-axis circle drawing range, and (E-3)determination of dots.

(E-1) Decision as to Whether or not Scanning Lines YN Belong to CircleDrawing Ranges

Each of the center of a start-point circle and the center of anend-point circle is set differently with respect to the odd-numberedwidth and even-numbered width of lines being drawn on the grid of themonitor screen. With respect to the even-numbered width of line as shownin FIG. 17A, the center of a circle lies on the line of the grid. Withrespect to the odd-numbered width of line as shown in FIG. 17B, thecenter of a circle lies at an intermediate position between adjacentlines on the grid. That is, Y-axis circle drawing ranges are calculateddifferently with respect to the odd-numbered width and even-numberedwidth of lines, wherein they are basically calculated by theaforementioned calculations regarding Y-axis line drawing ranges in theline terminating processing, as follows:

Odd-numbered width:

LSY+0.5−LW/2≦YN<LSY+0.5+LW/2

-   -   (Y-axis circle drawing range for a start-point circle)

LEY+0.5−LW/2≦YN<LEY+0.5+LW/2

-   -   (Y-axis circle drawing range for an end-point circle)

Even-numbered width:

LSY−LW/2≦YN<LSY+LW/2

-   -   (Y-axis circle drawing range for a start-point circle)

LEY−LW/2≦YN<LEY+LW/2

-   -   (Y-axis circle drawing range for an end-point circle)

(E-2) Calculations of X-Axis Circle Drawing Ranges

X-axis circle drawing ranges are calculated differently with respect tothe odd-numbered width and even-numbered width of lines as shown inFIGS. 17A and 17B, wherein X-axis coordinates XL of leftmost dots DRSand X-axis coordinates XR of rightmost dots DRE are calculated asfollows:

(a) Calculations of X-axis coordinates of leftmost dots DRS

Odd-numbered width: XL=LSX+0.5−LW/2

XR=LSX+0.5+LW/2

Even-numbered width: XL=LSX−LW/2

XR=LSX+LW/2

(b) Calculations of X-Axis Coordinates of Rightmost Dots DRE

Odd-numbered width: XL=LEX+0.5−LW/2

XR=LEX+0.5+LW/2

Even-numbered width: XL=LEX−LW/2

XR=LEX+LW/2

(E-3) Determination of Dots

The grid of the monitor screen is divided into a plurality ofrectangular segments (e.g., dots each having a unit width) encompassedby line segments as shown in FIGS. 18A and 18B, wherein the total numberof segments arranged horizontally within a circle is counted todetermine the width of the line, which is either an even-numbered widthor an odd-numbered width. Circle drawing data are created in advancewith respect to segment 1-16 and are stored in a ROM.

Next, circle drawing data stored in the ROM will be described withreference to FIGS. 18A and 18B, wherein FIG. 18A shows that the width LWof the line is “16” (i.e., sixteen segments) representing aneven-numbered width, and FIG. 18B shows that the width LW of the line is“15” (i.e., fifteen segments) representing an odd-numbered width. TheROM stores circle drawing data with regard to only a quarter portion ofa circle, wherein “1” is set to each of addresses belonging to thecircle, while “0” is set to each of addresses not belonging to thecircle. Such 1-bit data is specified and read from the ROM upon thedesignation of a pair of an Y-axis address Y_AD and an X-axis addressX_AD. In the case of LW=16 (see FIG. 18A), for example, “1” is read fromthe ROM upon the designation of a Y-axis address Y_AD=3 and an X-axisaddress X_AD=3 so that the corresponding dot is subjected to drawing,while “0” is read from the ROM upon the designation of a Y-axis addressY_AD=6 and an X-axis address X_AD=6 so that the corresponding dot is notsubjected to drawing.

Next, calculations regarding the Y-axis address Y_AD and the X-axisaddress X_AD will be described below.

(a) Calculations of Y-Axis Addresses Y_AD

Y-axis addresses of the ROM are calculated based on coordinates YN ofscanning lines. Herein, Y-axis addresses are calculated differently withrespect to the odd-numbered width and even-numbered width of lines, asfollows:

(i) Calculations regarding start-point circles

Odd-numbered width: Y _(—) AD=abs(YN−LSY)

Even-numbered width: Y _(—) AD=INT(abs(YN+0.5−LSY))

(ii) Calculations regarding end-point circles

Odd-numbered width: Y _(—) AD=abs(YN−LEY)

Even-numbered width: Y _(—) AD=INT(abs(YN+0.5−LEY))

In the above, the function “abs(A)” produces an absolute value of ‘A’;and the function “INT(A)” produces an integer of “A”.

(b) Calculations regarding X-axis addresses X_AD

Prescribed dots ranging from DRS to DRE, which are calculated withrespect to the X-axis circle drawing range, are subjected to circledrawing processing. First, X-axis addresses X_AD of the ROM arecalculated with regard to coordinates XN regarding dots subjected tocircle drawing processing, wherein they are calculated differently withrespect to the odd-numbered width and even-numbered width of lines, asfollows:

(i) Calculations regarding start-point circles

Odd-numbered width: X _(—) AD=abs(XN−LSX)

Even-numbered width: X _(—) AD=INT(abs(XN+0.5−LSX))

(ii) Calculations regarding end-point circles

Odd-numbered width: X _(—) AD=abs(XN−LEX)

Even-numbered width: X _(—) AD=INT(abs(XN+0.5−LEX))

Prescribed data (i.e., “1” and “0”) are read from the ROM based onY-axis addresses Y_AD and X-axis addresses X_AD, which are calculated asdescribed above, wherein color codes representing the color of a lineare written with respect to dots corresponding to “1”, and they are notwritten with respect to other dots corresponding to “0”.

The present embodiment uses the ROM for storing a plurality of 1-bitdata at respective addresses used for the execution of circle drawingprocessing. Of course, it is possible to modify the present embodimentsuch that the ROM stores a plurality of multi-bit data at respectiveaddresses. This makes it possible to realize alpha (α) blending incircle drawing processing. According to the alpha blending, it ispossible to display prescribed images (e.g., lines and circles) withcomposite colors merging into background images on the monitor screen.For example, when a plurality of 4-bit data are stored in the ROM, it ispossible to perform alpha blending in the following sixteen stagesrepresented by the binary notation of 4-bit data, in which “C” denotescolor codes of a circle, and “B” denotes color codes of a backgroundimage.

(Binary notation of 4-bit data) (Alpha blending operation) 0000 C ×15/16 + B × 0/16 0001 C × 15/16 + B × 1/16 . . . . . . 1111 C × l/16 + B× l5/16

Incidentally, circle drawing processing not using alpha blending isperformed as follows:

(Binary notation of 4-bit data) (Circle drawing data) “0000” to “0111”Color codes of a circle “1000” to “1111” No drawing

The aforementioned alpha blending can be applied to antialiasing withregard to outer peripheries of circles. Antialiasing is a technique foreliminating irregularities or stairstep appearances of slanted lines orcurves at their boundaries on computer displays that display imagesusing dots. Antialiasing can be realized by performing alpha blending onboundaries of circles, which are displayed using dots. In the case ofLW=16 shown in FIG. 18A, for example, 1-bit data corresponding to “1” isstored in the ROM with regard to a Y-axis address Y_AD=1 and an X-axisaddress X_AD=7. In consideration of the inner-circle area ratio of thedot, which is expressed as “15:1” (i.e., the dot has an inner circlearea rated “15” and an outer circle area rated “1”), for example, 4-bitdata whose binary notation is “0001” is stored in the ROM with regard tothe aforementioned addresses. In this case, the dot is displayed by useof color data, which is expressed as “C× 15/16+B× 1/16”. Similaradjustments can be made with regard to other dots along the outerperiphery of a circle. Thus, dots belonging to a circle drawn on themonitor screen is displayed in such a way that each dot having a highinner-circle area ratio is emphasized in the color of the circle, whileeach dot having a low inner-circle area ratio is emphasized in the colorof the background image. As a result, it is possible to reduceirregularities or stairstep appearances on the outer periphery of acircle drawn on the monitor screen.

As this invention may be embodied in several forms without departingfrom the spirit or essential characteristics thereof, the presentembodiment is therefore illustrative and not restrictive, since thescope of the invention is defined by the appended claims rather than bythe description preceding them, and all changes that fall within metesand bounds of the claims, or equivalents of such metes and bounds aretherefore intended to be embraced by the claims.

1. An image processing method adapted to a display apparatus using aplurality of line buffers for storing data regarding dots aligned onscanning lines displayed on a screen, said image processing methodcomprising the steps of: when drawing a line having a predeterminedwidth and a predetermined length on the screen, detecting dots belongingto a virtual circle, which is drawn at one end of the line and whosediameter matches the width of the line; and writing data regarding thedetected dots into at least one of the line buffers.
 2. An imageprocessing method adapted to a display apparatus using a plurality ofline buffers for storing data regarding dots aligned on scanning linesdisplayed on a screen, said image processing method comprising the stepsof: reading line attribute data representing attributes of a line,having a prescribed width and a prescribed length, to be drawn on thescreen from a storage device; making a decision as to whether or not theline attribute data designate line terminating processing to beperformed on at least one end of the line; in the line terminatingprocessing, detecting dots belonging to a virtual circle, which is drawnat one end of the line and whose diameter matches the width of the line;and writing data regarding the detected dots into at least one of theline buffers.
 3. An image processing method according to claim 2,wherein the dots are detected based on the line attribute datadesignating the line terminating processing with reference tostart-point coordinates or end-point coordinates of the line.
 4. Animage processing method according to claim 3, wherein the dots aredetected based on area ratios, each of which is calculated withreference to a boundary of the virtual circle drawn at one end of theline.
 5. An image processing apparatus adapted to a display apparatususing a plurality of line buffers for storing data regarding dotsaligned on scanning lines displayed on a screen, said image processingapparatus comprising: a detection section for when a line having aprescribed width and a prescribed length is drawn on the screen,detecting dots belonging to a virtual circle, which is drawn at one endof the line and whose diameter matches the width of the line; and awrite section for writing data regarding the detected dots into at leastone of the plurality of line buffers.
 6. An image processing apparatusadapted to a display apparatus using a plurality of line buffers forstoring data regarding dots aligned on scanning lines displayed on ascreen, said image processing apparatus comprising: a read section forreading line attribute data regarding a line, having a prescribed widthand a prescribed length, to be drawn on the screen, from a storagedevice; a decision section for making a decision as to whether or notthe line attribute data designate line terminating processing; adetection section for in the line terminating processing, detecting dotsbelonging to a virtual circle, which is drawn at one end of the line andwhose diameter matches the width of the line; and a write section forwriting data regarding the detected dots into at least one of the linebuffers.
 7. An image processing apparatus according to claim 6, whereinthe dots are detected based on the line attribute data designating theline terminating processing with reference to start-point coordinates orend-point coordinates of the line.
 8. An image processing apparatusaccording to claim 7, wherein the dots are detected based on arearatios, each of which is calculated with reference to a boundary of thevirtual circle drawn at one end of the line.